package com.yike.user.mq;

import com.yike.user.entity.*;
import com.yike.user.mapper.MessageReminderMapper;
import lombok.extern.java.Log;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Log
@Component
@RocketMQMessageListener(topic = "message_reminder_topic", consumerGroup = "message_reminder_group")
public class MessageReminderListener implements RocketMQListener<MessageReminder> {

    @Autowired
    private MessageReminderMapper messageReminderMapper;

    @Override
    public void onMessage(MessageReminder messageReminder) {
        log.info("message_reminder_topic 接收到消息：" + messageReminder.toString());
        // 收到消息更新状态
        messageReminderMapper.updateById(messageReminder);
    }

}
